package com.lianjia.sh.se;

import org.junit.runner.RunWith;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;

/**
 * Created by yangsp1 on 16/7/19.
 */

@RunWith(SpringJUnit4ClassRunner.class) // SpringJUnit支持，由此引入Spring-Test框架支持！
@SpringApplicationConfiguration(classes = App.class) // 指定我们SpringBoot工程的Application启动类
//@WebAppConfiguration // 由于是Web项目，Junit需要模拟ServletContext，因此我们需要给我们的测试类加上@WebAppConfiguration。
public class BaseJunit {

    public void waitChildThreads() throws InterruptedException {
        int count = Thread.currentThread().getThreadGroup().activeCount();
        Thread[] list = new Thread[count];
        Thread.currentThread().getThreadGroup().enumerate(list);

        for(Thread thread : list){
            thread.join();
        }
    }
}
